long JS_GetArrayLength()

Description Given a pointer to an array object, gets the number of elements in the array.
Arguments JSContext *cx, JSObject *obj
cx is the opaque JSContext pointer that was passed to the JavaScript function.
obj is a reference to an array object.
Returns The number of elements in the array, or -1 upon failure.